import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { ApiService } from '../api/api.service';
import { ApiUrl } from '../api/ApiUrl';
import { BankVO } from '../vo/BankVO';
@Component({
  selector: 'app-bankdetails',
  templateUrl: './bankdetails.page.html',
  styleUrls: ['./bankdetails.page.scss'],
})
export class BankdetailsPage implements OnInit {
  iid: any;
  item: BankVO ;
  constructor(public api: ApiService,
    public activatedRoute: ActivatedRoute,
   ) { }

  ngOnInit() {
    this.iid = this.activatedRoute.snapshot.paramMap.get('iid');
    this.onSearch(this.iid);
  }
  onSearch(iid: string) {
    this.api.getItem<BankVO>(ApiUrl.getOneBank, { 'iid': iid }).subscribe(response => {

      if (response === null) {
        console.log('没有数据返回');
        return;
      }
      console.log(response);
       this.item = response;
       console.log(response);
    }, () => {
      console.log('出错了');
    });
  }
}
